<?php namespace App\Infra;

use App\Utils\ModelOperatorTrait;
use App\Models\Recovery;
use App\Models\RecoveryType;

class RecoveryManager{

	use ModelOperatorTrait;

	public function createRecovery($data){

		return $this->create(Recovery::class,$data);
	}

	public function getReoverise($conditions = null,$first = false){
		return $this->findModel(Recovery::class,Recovery::query()->with(['recoveryType']),$conditions,$first);
	}

	public function updateRecovery($id,$data){
		$recovery = Recovery::find($id);

		$recovery->update($data);

		return $recovery;
	}

	public function getRecoveryTypes($conditions = null,$first = false){
		return $this->findModel(RecoveryType::class,RecoveryType::query(),$conditions,$first);
	}
	
}